HTMLDOC = htmldoc
AWK = awk
RST2HTML = rst2html
DOT = dot

HTMLDOCS = \
	   doc/dbridge-linux.html \
	   doc/dbridge-help.html \
	   doc/dbridge-help.stage1.html

GENERATED_IMAGES = doc/images/messageflow.png
IMAGES = $(GENERATED_IMAGES) \
      	doc/images/db-initial.png \
      	doc/images/fpnp-binkd.png \
      	doc/images/fpnp-install.png

GENERATED = $(GENERATED_IMAGES) $(HTMLDOCS)

%.html: %.txt
	$(RST2HTML) $< $@

%.png: %.dot
	$(DOT) -Tpng -o $@ $<

all: $(HTMLDOCS) $(IMAGES)

doc/dbridge-linux.html: doc/dbridge-linux.txt

doc/dbridge-help.stage1.html: doc/dbhelp.txt
	$(AWK) -f ./scripts/dbhelp2html.awk $< \
		| $(AWK) -f ./scripts/lister.awk > $@

doc/dbridge-help.html: doc/dbridge-help.stage1.html doc/title.html
	$(HTMLDOC) --titlefile doc/title.html --book -t html $< \
		| tidy -asxhtml 2> /dev/null \
		| ./scripts/fixup-html.sed > $@ || rm -f $@

clean:
	rm -f $(GENERATED)

upload: all
	rsync --delete -a -v \
		--exclude=".svn/" \
		--exclude="*.raw" \
		--exclude="*.swp" \
		--delete-excluded \
		doc/ \
		inuyasha.oddbit.com:/sites/www.oddbit.com/html/fidonet/dbridge/

